package com.cimp.domain.iqy;

import java.io.Serializable;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * [简要描述]: 同步任务执行进度
 * [详细描述]:
 *
 * @author huojinhao
 * @date 2018/7/17
 */
public class Schedule implements Serializable{

    private static final long serialVersionUID = 1534276532220689827L;

    /**
     * 全量任务状态
     */
    private boolean isRunning;

    /**
     * 全量任务总数
     */
    private int totalCount;

    /**
     * 全量内容任务剩余
     */
    private int remaining;

    /**
     * 增量任务总数
     */
    private int incrCount;

    public void init(int totalCount){
        this.totalCount = totalCount;
        this.remaining = totalCount;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public void running(){
        this.isRunning = true;
    }

    public boolean isRunning() {
        return isRunning;
    }

    public void stopRunning() {
        this.isRunning = false;
        this.totalCount = 0;
    }

    public int getRemaining() {
        return remaining;
    }

    public void setRemaining(int remaining) {
        this.remaining = remaining;
    }

    public boolean continueOrStop() {
        remaining--;
        return isRunning;
    }

    public int getIncrCount() {
        return incrCount;
    }

    public void setIncrCount(int incrCount) {
        this.incrCount = incrCount;
    }
}
